﻿
@{
    ViewBag.Title = "Onlines";
}
<link href="~/Content/bootstrap.min.css" rel="stylesheet" />
<script src="~/Scripts/jquery-3.1.1.min.js"></script>
<script src="~/Scripts/bootstrap.min.js"></script>
<h2>Onlines</h2>
<table class="table table-hover">
    <tr>
        <th>
            链接id
        </th>
        <th>
            时间
        </th>
    </tr> 
    <tbody id="a">

    </tbody>
</table>
 
<script>
    $(function () {
        GetData();
        setInterval(function () {
            GetData();
        }, 10000);
    });
    function GetData() {
        $.getJSON('@Url.Action("GetOnlines")', {}, function (rps) {
            
            var lis = [];
            $.each(rps, function (index, item) {
                lis.push('<tr><td> ' + item.ConnectionId + '</td><td>' + item.Times + '</td></tr>');
                
            });
            document.getElementById('a').innerHTML = lis.join(' ');
        });
      
    }
</script>
 